import {init,h} from 'snabbdom'
//导入模块
import style from 'snabbdom/modules/style'
import eventlisteners from 'snabbdom/modules/eventlisteners'
// import style from 'snabbdom/build/package/modules/style'
// import eventlisteners from 'snabbdom/build/package/modules/eventlisteners'

//注册模块
let patch = init([
    style,
    eventlisteners
])
//使用h函数第二个参数传入模块需要的数据

let vnode = h('div',{
    style: {
        backgroundColor:'red'
    },
    on: {
        click: eventHandler
    }
},[
    h('h1','title'),
    h('p','this is p')
])

function eventHandler(){
    alert('click')
}

let app = document.querySelector('#app')
patch(app, vnode)
